<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网上商城</title>
    <link rel="stylesheet" th:href="@{~/bootstrap/css/bootstrap.min.css}">
    <script th:src="@{~/js/jquery-3.2.1.min.js}"></script>
    <script th:src="@{~/bootstrap/js/bootstrap.min.js}"></script>
    <style>
        .bg{
            /* background-color: aquamarine; */
            margin-top: 5px;
            
        }
    </style>
</head>
<body>
    <div class="container">
        <nav class="navbar navbar-inverse">
            <ul class="nav navbar-nav">
                <li class="active"><a th:href="@{/preindex/preindex}">首页 <span class="sr-only">(current)</span></a></li>
                <li><a th:href="@{/order/order}">订单</a></li>
            </ul>
        </nav>
        <div class="panel panel-primary">
            <div class="panel-body">
                <table class="table">
                    <thead>
                    <tr>
                        <th>图片</th>
                        <th>名称</th>
                        <th>数量</th>
                        <th>总价</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="order : ${orderList}">
                        <th>
                            <img width="60" height="60" th:src="@{~/img/{img}(img=${order.goods.img})}" alt="">
                        </th>
                        <th th:text="${order.goods.goodsname}"></th>
                        <th th:text="${order.num}"></th>
                        <th th:text="${order.num*order.goods.price}"></th>
                        <th>
                            <a th:href="@{/order/deleteorder/{id}(id=${order.id})}">删除</a>
                        </th>
                    </tr>
                    </tbody>
                    <tfoot>
                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            <li>
                                <a th:href="@{/order/order(current=${current - 1==0?1:current - 1})}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li th:attr="class=${current == num?'active':''}" th:each="num : ${#numbers.sequence(1,page)}">
                                <a th:href="@{/order/order(current=${num})}" th:text="${num}">1</a>
                            </li>
                            <li>
                                <a th:href="@{/order/order(current=${current + 1>page?page:current + 1})}" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </ul>
                    </nav>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>

    <script>
        $('#nav a').click(function (e) {
            e.preventDefault()
            $(this).tab('show')
        })
    </script>
</body>
</html>